package com.chengqs.mapper;

import com.chengqs.pojo.DTO.PageQuery;
import com.chengqs.pojo.entity.Movie;
import com.chengqs.pojo.entity.UserMovie;
import com.github.pagehelper.Page;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;

public interface UserMovieMapper {

    @Select("select count(1) from user_movie where user_id = #{userId} and movie_id = #{movieId}")
    int selectCountByUserId(UserMovie userMovie);

    @Insert("insert into user_movie(user_id,movie_id) values(#{userId},#{movieId})")
    void insert(UserMovie userMovie);

    @Select("select m.* from user_movie um left join movie m on um.movie_id = m.id where um.user_id = #{userId}")
    Page<Movie> getMyStar(PageQuery pageQuery);
}
